package com.bjtu.ptsite.config;



import com.bjtu.ptsite.interceptor.Interceptor;
import org.apache.catalina.connector.Connector;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 *
 * @author Zehao Wang, Junjie Zhang, Yutao Wei
 *
 */
@Configuration
public class Config implements WebMvcConfigurer {


    @Autowired
    private Interceptor interceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //添加拦截器对象,并指定拦截的资源路径
        registry.addInterceptor(interceptor).addPathPatterns("/**").excludePathPatterns("/login");
    }

//    @Bean
//    public TomcatServletWebServerFactory tomcatCustomizer() {
//        return new TomcatServletWebServerFactory() {
//            @Override
//            protected void customizeConnector(Connector connector) {
//                connector.setProperty("rejectIllegalHeader", "false");
//            }
//        };
//    }

}
